package com.huawei;

import java.util.Random;
import java.util.Scanner;

public class yang {
    public static void main(String[] args) {
        int win=0;
        int lose=0;
        int tie=0;
        System.out.println("要不要来玩石头剪刀布呀？");
        System.out.println("跟电脑玩哦");
        System.out.println("看的出来你很想玩\n");
        System.out.println("1是石头 2是剪刀 3是布");
        System.out.println("开始咯\n"+
                "石头 剪刀 布");
        Scanner gesture = new Scanner(System.in);
        System.out.println("开始game");
        for(int i=1;i<=5;i++){
            System.out.println("第"+i+"局");
            int randomNumber = new Random().nextInt(3)+1;
            int own=gesture.nextInt();

            if(own==1){
                System.out.println("你出的是:石头");
            }else if(own==2){
                System.out.println("你出的是:剪刀");
            }else if(own==3)
                System.out.println("你出的是:布");

            if(randomNumber==1){
                System.out.println("电脑出的是:石头");
            }else if(randomNumber==2){
                System.out.println("电脑出的是:剪刀");
            }else if(randomNumber==3)
                System.out.println("电脑出的是:布");

            if(randomNumber==1){
                if(own==1){
                    System.out.println("咱平");tie++;
                }else if(own==2){
                    System.out.println("你输");lose++;
                }else if(own==3){
                    System.out.println("你赢");win++;
                }
            }else if(randomNumber==2) {
                if (own==1) {
                    System.out.println("你赢");win++;
                } else if (own==2) {
                    System.out.println("咱平");tie++;
                } else if(own==3) {
                    System.out.println("你输");lose++;
                }
                }else if(randomNumber==3) {
                if (own==1) {
                    System.out.println("你输");lose++;
                } else if (own==2) {
                    System.out.println("你赢");win++;
                } else if(own==3) {
                    System.out.println("咱平");tie++;
                }
              }
            System.out.println("当前比分"+win+":"+lose);
            }
        if(win>lose){
            System.out.println("你赢了比赛！！！");
        }else if (win<lose){
            System.out.println("输了。不要气馁，输赢乃兵家常事。cheer up！！！");
        }else{
            System.out.println("平局哦，你的大脑已经赶上电脑了。真厉害！");
        }

        }
    }

